<div class="row toolbar">
  <div class="col-md-6">
    <span class="toolbar-header">
      <%= @stock_logging.new_record? ? "#{t(:new_log_stock_transaction)}" : "#{t(:edit)} #{t(:log_stock_transaction)}" %>
    </span>
  </div>
  <div class="col-md-6 text-right">
    <ul class="toolbar-nav">
      <li><%= link_to simple_icon("user"), @stock_logging %></li>
      <li><%= link_to simple_icon("users"), stock_loggings_path %></li>
    </ul>
  </div>
</div>

<%= form_for(@stock_logging, url:
if action_name == "edit" or action_name == "update" 
	drug_stock_logging_path
else
	drug_stock_loggings_path
end
) do |f| %>
  <% if @stock_logging.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@stock_logging.errors.count, "error") %> prohibited this stock_logging from being saved:</h2>

      <ul>
      <% @stock_logging.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
  
  <% if notice or alert %>
  <p class="notice"><%= notice %></p>
  <p class="alert"><%= alert %></p>
  <% end %>
  
  <div class="form-group">
    <%= f.label :drug_id %><br>
    <%= f.collection_select(:drug_id, Drug.all, :id, :name, prompt: true) %>
    <%= link_to feather_icon('circle-plus'), new_drug_drug_path %>
  </div><div class="field">
  <div class="form-group">
    <%= f.label :inventory_id %><br>
    <%= f.collection_select(:inventory_id, Inventory.all, :id, :name, prompt: true) %>
    <%= link_to feather_icon('circle-plus'), new_drug_inventory_path %>
  </div>
  <div class="form-group">
    <%= f.label :quantity %><br>
    <%= f.text_field :quantity %>
  </div>
  <div class="form-group">
    <%= f.label :stock_logging_category_id %><br>
    <%= f.collection_select(:stock_logging_category_id, StockLoggingCategory.all, :id, :name, prompt: true) %>
  </div>
  <%= f.submit class: "btn btn-primary" %>
<% end %>
